<?php
$a=1;
$b=1;

$pid=pcntl_fork();
if($pid ==-1){
    exit("err fork");
}
if($pid ==0){

    $a++;
    $b++;
    echo posix_getpid().":"."a=".$a.",b=".$b.PHP_EOL;

}else{
    $a+=2;
    $b+=2;
    echo posix_getpid().":"."a=".$a.",b=".$b.PHP_EOL;
    pcntl_wait($status);
    var_dump(pcntl_wifexited($status));
}

echo posix_getpid().":"."a=".$a.",b=".$b.PHP_EOL;

/**
父子进程间数据互相不干扰


 */